package ru.urfc.portal.ui.client;

import static ru.urfc.portal.ui.client.Constants.DOCUMENT_TYPE_CALCULATE_ZONE;
import static ru.urfc.portal.ui.client.Constants.DOCUMENT_TYPE_DOCS_ORDER;
import static ru.urfc.portal.ui.client.Constants.DOCUMENT_TYPE_IMPORT_EXPERTISE;
import static ru.urfc.portal.ui.client.Constants.DOCUMENT_TYPE_LETTER;
import static ru.urfc.portal.ui.client.Constants.DOCUMENT_TYPE_NOISE_ELIMINATION;
import static ru.urfc.portal.ui.client.Constants.DOCUMENT_TYPE_PARAMETERS_CONFIRMATION;
import static ru.urfc.portal.ui.client.Constants.DOCUMENT_TYPE_REG_DATA_CHANGE;
import static ru.urfc.portal.ui.client.Constants.DOCUMENT_TYPE_SERVICE_ORDER;
import static ru.urfc.portal.ui.client.Constants.DOCUMENT_TYPE_STOP_EXPLOITATION;
import static ru.urfc.portal.ui.client.Constants.DOCUMENT_TYPE_TURNON_NOTICE;

import java.util.HashMap;
import java.util.Map;

import ru.urfc.portal.ui.client.googlets.client.documents.CalculateZone;
import ru.urfc.portal.ui.client.googlets.client.documents.DocsOrder;
import ru.urfc.portal.ui.client.googlets.client.documents.ImportExpertise;
import ru.urfc.portal.ui.client.googlets.client.documents.Letter;
import ru.urfc.portal.ui.client.googlets.client.documents.NoiseElimination;
import ru.urfc.portal.ui.client.googlets.client.documents.ParametersConfirmation;
import ru.urfc.portal.ui.client.googlets.client.documents.RegDataChange;
import ru.urfc.portal.ui.client.googlets.client.documents.ServiceOrder;
import ru.urfc.portal.ui.client.googlets.client.documents.StopExploitation;
import ru.urfc.portal.ui.client.googlets.client.documents.TurnonNotice;

public class DocumentResolverGwt {
	
	private final Map<String, BaseDocument> map = initMap();
	
	Map<String, BaseDocument> initMap() {
		final Map<String, BaseDocument> map = new HashMap<String, BaseDocument>();
		map.put(DOCUMENT_TYPE_STOP_EXPLOITATION, new StopExploitation());
		map.put(DOCUMENT_TYPE_CALCULATE_ZONE, new CalculateZone());
		map.put(DOCUMENT_TYPE_IMPORT_EXPERTISE, new ImportExpertise());
		map.put(DOCUMENT_TYPE_NOISE_ELIMINATION, new NoiseElimination());
		map.put(DOCUMENT_TYPE_PARAMETERS_CONFIRMATION, new ParametersConfirmation());
		map.put(DOCUMENT_TYPE_SERVICE_ORDER, new ServiceOrder());
		map.put(DOCUMENT_TYPE_TURNON_NOTICE, new TurnonNotice());
		map.put(DOCUMENT_TYPE_LETTER, new Letter());
		map.put(DOCUMENT_TYPE_DOCS_ORDER, new DocsOrder());
		map.put(DOCUMENT_TYPE_REG_DATA_CHANGE, new RegDataChange());
		return map;
	}
	
	public BaseDocument document(String typeCode) {
		return map.get(typeCode);
	}
	
}
